package com.rljk;

import com.cxytiandi.encrypt.anno.EnableEncrypt;
import org.java_websocket.client.WebSocketClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
@EnableTransactionManagement // 启注解事务管理，等同于xml配置方式的 <tx:annotation-driven />
@MapperScan("com.rljk.dao.mapper")
@EnableEncrypt
@EnableCaching  //@redis使用缓存-2（共3步）
@EnableAutoConfiguration
//@ServletComponentScan      //如果打war包，3.使过滤器生效        继承SpringBootServletInitializer   打成war使用
@EnableScheduling   //开启定时任务
@EnableAsync     //
public class StealthApplication /*extends SpringBootServletInitializer*/{


	public static void main(String[] args) {
		SpringApplication.run(StealthApplication.class, args);
	}

//	@Bean(name="taskExecutor")
//	public TaskExecutor getTaskExecutor() {
//		ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
//		taskExecutor.setCorePoolSize(100);
//		taskExecutor.setMaxPoolSize(2000);
//		taskExecutor.setThreadNamePrefix("worker-");
//		return taskExecutor;
//	}
//
//	@Bean
//	public TaskScheduler getTaskScheduler() {
//		return new ThreadPoolTaskScheduler();
//	}

//	@Override
//	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
//		return builder.sources(StealthApplication.class);
//	}
}
